﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl x:Class="Coding4Fun.BoxingBots.Boxer.Controls.Thumbstick"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Controls="clr-namespace:Coding4Fun.BoxingBots.Boxer.Controls" 
			 mc:Ignorable="d">
	<Grid x:Name="LayoutRoot">

		<Grid.RowDefinitions>
			<RowDefinition Height="200" />
			<RowDefinition Height="1" />
			<RowDefinition Height="30" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="200" />
			<ColumnDefinition Width="1"/>
			<ColumnDefinition Width="30" />
		</Grid.ColumnDefinitions>
		<Grid>
			<Ellipse Fill="#eaeaea" Stroke="#ddd" StrokeThickness="3" x:Name="OuterCircle" />
			<Ellipse Width="30" Height="30" StrokeThickness="3" Stroke="#bbb" Fill="#ccc" x:Name="InnerCircle" RenderTransformOrigin=".5, .5">
				<Ellipse.RenderTransform>
					<TranslateTransform x:Name="InnerCircleTranslate"/>
				</Ellipse.RenderTransform>
			</Ellipse>
			<TextBlock Text="{Binding Path=HorizontalValue, RelativeSource={RelativeSource AncestorType={x:Type Controls:Thumbstick}}}" VerticalAlignment="Bottom" HorizontalAlignment="Left"  />
			<TextBlock Text="{Binding Path=VerticalValue, RelativeSource={RelativeSource AncestorType={x:Type Controls:Thumbstick}}}" VerticalAlignment="Top" HorizontalAlignment="Right"  />
		</Grid>
		<Slider
            x:Name="ThumbstickHorizontal" 
            Value="{Binding Path=HorizontalValue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type Controls:Thumbstick}}}"
            Grid.ColumnSpan="2"
            Grid.Row="2" 
            Orientation="Horizontal" 
            VerticalAlignment="Center" 
            ValueChanged="Thumbstick_ValueChanged" 
            Minimum="-1" 
            Maximum="1" />
		<Slider
            x:Name="ThumbstickVertical" 
            Value="{Binding Path=VerticalValue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type Controls:Thumbstick}}}"
            Grid.RowSpan="2"
            Grid.Column="2" 
            Orientation="Vertical"
            HorizontalAlignment="Center" 
            ValueChanged="Thumbstick_ValueChanged" 
            Minimum="-1" 
            Maximum="1" />
	</Grid>
</UserControl>
